package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.Sign;

import cn.wolfcode.trip.base.service.ISignService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("sign")
public class SignController {
    @Autowired
    private ISignService signService;
    @GetMapping("/{userId}")
    public Sign get(@PathVariable Long userId){

        return signService.achieve(userId);
    }
    @RequestMapping("/update")
    public JSONResult update(Sign sign){
        JSONResult result = new JSONResult();
        try {
            signService.renew(sign);
        } catch (Exception e) {
            result.mark(e.getMessage());
        }
        return result;
    }
}
